package dj.tic;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;

import dj.engine.panel.Panel;
import dj.engine.panel.TextPanel;
import dj.engine.screen.LayoutManager;
import dj.engine.screen.ProportionalLayout;
import dj.engine.util.Vec2f;
import dj.engine.util.Vec2i;

public class TicHUDPanel extends Panel {

	private TextPanel turnPanel;
	private TextPanel timerPanel;
	private LayoutManager layout;
	private TicState game;
	protected TicHUDPanel(Vec2f dimensions, Vec2f position, TicState game) {
		super(dimensions, position);
		layout = new ProportionalLayout();
		turnPanel = new TextPanel(dimensions, position, Color.black);
		timerPanel = new TextPanel(dimensions, position, Color.black);
		layout.add(turnPanel, ProportionalLayout.FIXED_PROPORTIONS, new Float(0.0), new Float(0.0));
		layout.add(timerPanel, ProportionalLayout.FIXED_PROPORTIONS, new Float(0.0), new Float(0.5));
		this.onResize(Vec2i.fromRounded(dimensions));
		this.game = game;
	}

	@Override
	public void onDraw(Graphics2D g)
	{
		turnPanel.onDraw(g);
		timerPanel.onDraw(g);
	}
	
	@Override
	public void onResize(Vec2i dimensions)
	{
		System.out.println(dimensions);
		super.onResize(dimensions);
		layout.onResize(dimensions);
		turnPanel.onResize(new Vec2i(dimensions.x, dimensions.y/2));
		timerPanel.onResize(new Vec2i(dimensions.x, dimensions.y/2));
	}
	
	@Override
	public void onTick(long nanosSincePreviousTick) {
		// TODO Auto-generated method stub
		turnPanel.setData(game.getTurnStatus());
		timerPanel.setData(game.getTimeStatus());
	}

	@Override
	public void onKeyTyped(KeyEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onKeyPressed(KeyEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onKeyReleased(KeyEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onMouseClicked(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onMousePressed(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onMouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onMouseDragged(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onMouseMoved(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onMouseWheelMoved(MouseWheelEvent e) {
		// TODO Auto-generated method stub

	}

}
